
export const useDate = () => {
    // 获取当前时间段
const date = new Date();

// 获取当前小时
const hour = date.getHours();

// 当前时间段判定数据
const timeList = [
    {
        title: '上午',
        startTime: 6,
        endTime: 11,
    },
    {
        title: '下午',
        startTime: 14,
        endTime: 20,
    },
    {
        title:' 中午',
        startTime: 12,
        endTime: 14,
    },
    {
        title:' 晚上',
        startTime: 18,
        endTime: 6,
    }
]

// 判断当前时间段
const currentTime = timeList.find((time, index) => {
    if (index === timeList.length - 1) return time
    if (hour >= time.startTime && hour < time.endTime) {
        return time
    }
})

return {
    currentTime
}
} 